import Cookies from 'js-cookie'

const TokenKey = 'token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
const userInfoKey = 'userInfo';
export const getUserInfo = () => {
  const userInfoString = Cookies.get(userInfoKey);
  if (userInfoString) {
    return JSON.parse(userInfoString);
  }
  return null;
};
export const setUserInfo = (userInfo) => Cookies.set(userInfoKey,userInfo);
export const removeUserInfo = () => Cookies.remove(userInfoKey);

